package com.wzy.designpattern.structural.facade;

/**
 * 描述
 * 创建人    Wzy
 * 创建时间: 2020-05-15  21:50
 */
public class GiftExchangeService {
    private QualifyServer qualifyServer = new QualifyServer();
    private PointsPaymentService pointsPaymentService = new PointsPaymentService();
    private ShippingService shippingService = new ShippingService();

//    public void setQualifyServer(QualifyServer qualifyServer) {
//        this.qualifyServer = qualifyServer;
//    }
//
//    public void setPointsPaymentService(PointsPaymentService pointsPaymentService) {
//        this.pointsPaymentService = pointsPaymentService;
//    }
//
//    public void setShippingService(ShippingService shippingService) {
//        this.shippingService = shippingService;
//    }

    public void giftExchange(PointGift pointGift) {
        if (qualifyServer.isAvailable(pointGift)) {
            if (pointsPaymentService.pay(pointGift)) {
                //支付成功
                String s = shippingService.shipGift(pointGift);
                System.out.println("物流下单成功,订单号:  " + s);
            }
        }

    }
}
